function getAjax(url) {
    return new Promise((resolve, reject) => {
        //创建对象
        let xhr = new XMLHttpRequest();
        xhr.onreadystatechange = function () {
            if (xhr.readyState === 4) {
                if (xhr.status >= 200 && xhr.status < 300) {
                    //响应数据
                    resolve(xhr.responseText)
                } else {
                    reject(xhr.responseText)
                }
            }
        }
        // 打开连接
        xhr.open("GET", url);
        // 发送请求
        xhr.send();
    })
}
